import 'package:flutter/material.dart';

class HomeLike extends StatelessWidget {
  HomeLike({super.key, required this.goodsList});

  List goodsList = [];

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
        shrinkWrap: true,
        physics: const NeverScrollableScrollPhysics(),
        itemBuilder: (context, index) {
          Map item = goodsList[index];
          return Container(
            color: Colors.white,
            padding: const EdgeInsets.all(10),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Image.network(
                  item['goods_image'],
                  width: 80,
                  height: 80,
                ),
                Expanded(
                    child: Padding(
                  padding: const EdgeInsets.only(left: 10),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        item['goods_name'],
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                      Text(
                        '已售${item['goods_sales']}件',
                        style: TextStyle(fontSize: 12, color: Colors.grey),
                      ),
                      Text(
                        '¥${item['goods_price_min']}',
                        style: TextStyle(color: Colors.red),
                      ),
                    ],
                  ),
                ))
              ],
            ),
          );
        },
        separatorBuilder: (context, index) {
          return Container(
            height: 6,
            color: Colors.grey[200],
          );
        },
        itemCount: goodsList.length);
  }
}
